package com.zzb.myshowme.view.activity;

import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;

import com.zzb.myshowme.R;
import com.zzb.myshowme.view.fragment.PasswordFragment;
import com.zzb.myshowme.view.fragment.PhoneRegisterToMessageFragment;
import com.zzb.myshowme.view.fragment.SendSecurityCodeFragment;

/**
 * 发送验证码
 */
public class SendSecurityCodeActivity extends BaseActivity {

    FragmentManager manager;
    public String phone;
    PhoneRegisterToMessageFragment ptf;
    PasswordFragment pf;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_send_security_code);
        getFragmentManager().beginTransaction().add(R.id.frameLayout, new SendSecurityCodeFragment()).commit();
    }

    /**
     * 跳转到用户资料注册页面
     */
    public void gotoPhoneRegsterToMessgae() {
        if (manager == null) {
            manager = this.getFragmentManager();
        }
        FragmentTransaction transaction = manager.beginTransaction();
        ptf = (PhoneRegisterToMessageFragment) manager.findFragmentByTag("message");
        if (ptf == null) {
            ptf = new PhoneRegisterToMessageFragment();
        }
        transaction.replace(R.id.frameLayout, ptf, "message");
        transaction.addToBackStack(null);
        transaction.commit();
    }


    /**
     * 跳转到修改密码界面
     */
    public void gotoGetPassword() {
        if (manager == null) {
            manager = this.getFragmentManager();
        }
        FragmentTransaction transaction = manager.beginTransaction();
        pf = (PasswordFragment) manager
                .findFragmentByTag("password");
        if (pf == null) {
            pf = new PasswordFragment();

        }
        transaction.replace(R.id.frameLayout, pf, "password");
        transaction.addToBackStack(null);
        transaction.commit();
    }

}
